% To calculate transition prob & its standardized one
clear all;
clc;
disp('To list diagonal elements of qtrly transition prob & its standardized one');
load prob_std_TP06QRJfinR5.mat
freqj=4;% 4 quarters
year_list=[1997:2009]';
year_list_text=num2str(year_list);
quarter_list=[1:4]';
quarter_list_text=num2str(quarter_list);
Rate_list=[0,1:0.5:5];
% T=zeros(length(year_list)*freqj,3);
digonal=zeros(length(year_list)*freqj,9);
filename='TP06_Q_RJ_fin_R5_pro_std_diagonal';
% prob=zeros(13,freqj,10,12);% the last column will be 1, so we ignore the 13th column and set it as 12 columns
% prob_std=zeros(13,freqj,10,12); % the 12th column is useless, we define 12 column for coding conveinence.

for i=2:13
    for j=1:freqj
%         T(4*(i-2)+j,1)=year_list(i,1);
%         T(4*(i-2)+j,2)=quarter_list(j,1);
        for d=2:10
        digonal(4*(i-2)+j,d-1)=prob_std(i,j,d,d);
        end
    end
end
xlswrite(filename, digonal, 'digonal');